Release 10.1A: OpenEdge Development:
.NET Open Clients
Establishing the connection
To establish a connection to an AppServer, you must instantiate an AppObject. You can create an AppObject using one of the four available constructors.
The following constructor establishes an AppServer connection, with the AppServer information specified in the
Connectionobject (connectObj):
Where
AppObjectis the name of the AppObject as defined in ProxyGen.A connection object can be instantiated with one of the constructors documented in the "Connection object" section.
The following constructor establishes an AppServer connection, with the specified AppServer connection information (
url), user ID, password, and information required by the AppServer application at connection time:
Where
Note: For an HTTPS connection using the AppServer Internet Adapter (AIA) with the Web server running on the .NET Open Client machine, you must specify the Internet host name (notAppObjectis the name of the AppObject as defined in ProxyGen."localhost") in theurlparameter exactly as it appears in the CN field of the Web server certificate.For more information on the AppServer URL connection parameter format and default connection information, see the sections on connecting to an AppServer using a URL in OpenEdge Application Server: Developing AppServer Applications .
The following constructor establishes an AppServer connection, with the specified user ID, password, and information required by the AppServer application at connection time:
Where
AppObjectis the name of the AppObject as defined in ProxyGen.The constructor above uses default AppServer connection information. This constructor defaults the URL to
AppServer://localhost:5162/appService, whereappServiceis the AppService setting specified on the General tab of the Generate dialog box in ProxyGen.The following constructor establishes an AppServer connection, with no specified AppServer information:
Where
AppObjectis the name of the AppObject as defined in ProxyGen.The constructor above uses default AppServer connection information. This defaults the URL to
AppServer://localhost:5162/appService, whereappServiceis the AppService setting specified on the General tab of the Generate dialog box in ProxyGen.Also see the information on connecting to an AppServer in OpenEdge Development: Open Client Introduction and Programming .
Handling connection exceptions
The creation of a connection to an AppServer should be wrapped with exception-handling code to avoid memory leaks and unnecessary allocation of client and server resources. Also, information received from a caught exception can be valuable in tracing and fixing connection errors.
The following is an example of handling connection exceptions:
This example executes the connect in the
tryblock. If there is an exception thrown by the process, thecatchblock displays the exception message to the user.The
catchblock is specifically catching theConnectException. For more information on .NET Open Client exceptions, see Chapter 6, " Handling Errors."The
finallyblock ensures that theDispose()method is called on the AppObject. By putting theDispose()method in thefinallyblock, you ensure that the connection is closed whether an exception occurs or the connect is successful.Supported AppServer model
For .NET Open Clients, the supported AppServer operating modes are the session-managed modes of state-aware, state-reset, and stateless, and the session-free mode state-free. For more information, see the discussion of “Session Modes” in the chapter on “Generating Proxies and Web Service Definitions” in the OpenEdge Development: Open Client Introduction and Programming .
To access a session-free AppServer, you must set the proxy property
PROGRESS.Session.SessionModelto 1. For more information, see Chapter 5, " Accessing Proxy Properties."
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |